lib: Delete old GFile path helpers, and migrate single last user
authorColin Walters <walters@verbum.org>
Wed, 29 Mar 2017 02:31:03 +0000 (22:31 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 30 Mar 2017 13:14:43 +0000 (13:14 +0000)
I happened to read this file and realized there's a lot of cruft left over from
the time when I liked `GFile` and `malloc()`ing like 50 times just to make a
pathname string. Delete it.

Closes: #767
Approved by: jlebon

src/libostree/ostree-sysroot-deploy.c
src/libotutil/ot-gio-utils.c
src/libotutil/ot-gio-utils.h

index ee25d3f0afde0a08a95cebc4a1b0b51ab3c5207f..0db09973430d8ca3f0c137d3e0b4eb0ec7b4b1d4 100644 (file)
@@ -2003,11 +2003,11 @@ allocate_deployserial (OstreeSysroot           *self,
 {
   guint i;
   int new_deployserial = 0;
-  g_autoptr(GFile) osdir = NULL;
   g_autoptr(GPtrArray) tmp_current_deployments =
     g_ptr_array_new_with_free_func (g_object_unref);
 
-  osdir = ot_gfile_get_child_build_path (self->path, "ostree/deploy", osname, NULL);
+  const char *osdir_name = glnx_strjoina ("ostree/deploy/", osname);
+  g_autoptr(GFile) osdir = g_file_resolve_relative_path (self->path, osdir_name);
 
   if (!_ostree_sysroot_list_deployment_dirs_for_os (osdir, tmp_current_deployments,
                                                     cancellable, error))
index da32653e8c6b51d92594fdc82342b9f28194ea38..51c29f39bc04a525323625ab01235a1f0b1d4029 100644 (file)
@@ -51,91 +51,6 @@ ot_gfile_type_for_mode (guint32 mode)
 }
 
 
-GFile *
-ot_gfile_from_build_path (const char *first, ...)
-{
-  va_list args;
-  const char *arg;
-  g_autofree char *path = NULL;
-  g_autoptr(GPtrArray) components = NULL;  
-
-  va_start (args, first);
-
-  components = g_ptr_array_new ();
-  
-  arg = first;
-  while (arg != NULL)
-    {
-      g_ptr_array_add (components, (char*)arg);
-      arg = va_arg (args, const char *);
-    }
-
-  va_end (args);
-
-  g_ptr_array_add (components, NULL);
-
-  path = g_build_filenamev ((char**)components->pdata);
-
-  return g_file_new_for_path (path);
-}
-
-GFile *
-ot_gfile_get_child_strconcat (GFile *parent,
-                              const char *first,
-                              ...) 
-{
-  va_list args;
-  GFile *ret;
-  GString *buf;
-  const char *arg;
-
-  g_return_val_if_fail (first != NULL, NULL);
-
-  va_start (args, first);
-  
-  buf = g_string_new (first);
-  
-  while ((arg = va_arg (args, const char *)) != NULL)
-    g_string_append (buf, arg);
-
-  va_end (args);
-
-  ret = g_file_get_child (parent, buf->str);
-  
-  g_string_free (buf, TRUE);
-
-  return ret;
-}
-
-GFile *
-ot_gfile_get_child_build_path (GFile      *parent,
-                               const char *first, ...)
-{
-  va_list args;
-  const char *arg;
-  g_autofree char *path = NULL;
-  g_autoptr(GPtrArray) components = NULL;  
-
-  va_start (args, first);
-
-  components = g_ptr_array_new ();
-  
-  arg = first;
-  while (arg != NULL)
-    {
-      g_ptr_array_add (components, (char*)arg);
-      arg = va_arg (args, const char *);
-    }
-
-  va_end (args);
-
-  g_ptr_array_add (components, NULL);
-
-  path = g_build_filenamev ((char**)components->pdata);
-
-  return g_file_resolve_relative_path (parent, path);
-}
-
 GFile *
 ot_gfile_resolve_path_printf (GFile       *path,
                               const char  *format,
index 34040238211c32e685e9506ac29865fcbfebc72c..fa7c69973faf328bb5ee3f5588bb44a4d6cf6140 100644 (file)
@@ -35,12 +35,6 @@ G_BEGIN_DECLS
 
 GFileType ot_gfile_type_for_mode (guint32 mode);
 
-GFile *ot_gfile_from_build_path (const char *first, ...) G_GNUC_NULL_TERMINATED;
-
-GFile *ot_gfile_get_child_strconcat (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-
-GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-
 GFile * ot_gfile_resolve_path_printf (GFile       *path,
                                       const char  *format,
                                       ...) G_GNUC_PRINTF(2, 3);